package org.xacmlauth.dao.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Properties;

public abstract class AbstractDAO {
	
	private static String DB_DRIVER = "com.mysql.jdbc.Driver";
	private static String DB_URL = "jdbc:mysql://localhost:3306/xacmlauth";
	private static String DB_USER = "xacmlauth";
	private static String DB_PASSWORD = "xacmlauth";
	
	public Connection getConnection() throws Exception {
		String dbDriver = DB_DRIVER;
		String dbURL = DB_URL;
		String dbUser = DB_USER;
		String dbPassword = DB_PASSWORD;
		
		Class.forName(dbDriver);			
		Connection connection = DriverManager.getConnection(dbURL, dbUser, dbPassword);
		
		connection.setAutoCommit(false);
		
		return connection;
	}
	
	
	public Connection getConnection1() throws Exception {
		String dbDriver = DB_DRIVER;
		String dbURL = "jdbc:mysql://localhost:3306/openmrs";
		String dbUser = "root";
		String dbPassword = "root";
		
		Class.forName(dbDriver);			
		Connection connection = DriverManager.getConnection(dbURL, dbUser, dbPassword);
		
		connection.setAutoCommit(false);
		
		return connection;
		
	}

}
